/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package finalsoft;

/**
 *
 * @author Administrator
 */
import javax.swing.table.AbstractTableModel ;

class DefaultTable extends AbstractTableModel{
	private String[] titles = {"姓名","年龄","性别","数学成绩","英语成绩","总分","是否及格"} ;
	private Object [][] userInfo = {
			{"李兴华",30,"男",89,97,186,true} ,
			{"李康",23,"女",90,93,183,false}
		} ;	// 定义数据
        DefaultTable(String[] tableTitle, Object[][] tableContent){
            this.titles = tableTitle;
            this.userInfo = tableContent;
        }
        DefaultTable(){};

	public int getColumnCount(){	// 取得列的数量
		return this.titles.length ;
	}
	public int getRowCount(){		// 取得行的数量
		return this.userInfo.length ;
	}
	public Object getValueAt(int rowIndex, int columnIndex){
		return this.userInfo[rowIndex][columnIndex] ;
	}
	public String getColumnName(int columnIndex){
		return this.titles[columnIndex] ;
	}
//	public Class<?> getColumnClass(int columnIndex) {	// 得到指定列的类型
//		return this.getValueAt(0,columnIndex).getClass() ;
//	}
	public boolean isCellEditable(int rowIndex, int columnIndex){	// 所有内容都可以编辑
		return true ;
	}
	public void setValueAt(Object aValue, int rowIndex, int columnIndex){
		this.userInfo[rowIndex][columnIndex] = aValue ;
	}
}
